package com.graduate.game.assignment.service;

import com.graduate.game.assignment.mapper.assignmentMapper;
import com.graduate.game.assignment.pojo.assignment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class publishServiceImpl implements publishService {

    @Autowired
    public assignmentMapper  assignmentmapper;
    @Override
    public boolean insert(assignment assignment) {
        int x = assignmentmapper.insertassignment(assignment);
        if(x>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public List<assignment> getAll() {
        return assignmentmapper.lookAll();
    }

    @Override
    public assignment getOneByID(String id) {
        return assignmentmapper.getOneById(id);
    }

    @Override
    public List<assignment> serchassignment(String title) {
       return assignmentmapper.serchassignment(title);
    }

    @Override
    public List<assignment> getallbypublisher(String publisher) {
        return assignmentmapper.getAllByUsername(publisher);
    }

    @Override
    public boolean delById(long id) {
        int x = assignmentmapper.delById(id);
        if(x>0){
            return true;
        }else {
            return false;
        }
    }
}
